package vip.xiaonuo.issued.util;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.lang.UUID;
import cn.hutool.extra.spring.SpringUtil;
import org.redisson.api.RAtomicLong;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;


public class SnowIdGen {


    public static final Snowflake snowflake = new Snowflake(0, 0);

    public static Long nextId() {
        RAtomicLong id = SpringUtil.getBean(RedissonClient.class).getAtomicLong("ID");
        return id.incrementAndGet();
    }


    public static Map<String, Object> getBaseMap() {
        Map<String, Object> map = new HashMap<>();
        map.put("serial_number", nextId());
        map.put("key", "ABCD1234");
        return map;
    }
}
